import axios from 'axios';

let baseUrl = '/api';
// let proBaseUrl = ''
// const baseUrl = process.env.NODE_ENV === 'development' ? baseUrl : proBaseUrl
const timeout = 30000;

var instance = axios.create({
  baseURL: baseUrl,
  timeout: timeout,
});

//   拦截请求
instance.interceptors.request.use(
  (config) => {
    return config;
  },
  (error) => {
    return Promise.reject(error);
  },
);

//  响应请求
instance.interceptors.response.use(
  (response) => {
    return response.data;
  },
  (error) => {
    return Promise.reject(error);
  },
);
export default instance;
